package com.longma.server.constant.enums;

/**
 * 云台方向
 */
public enum  PTZDirectionEnum implements IBaseEnum<Integer> {
    //上
    TOP(0,"上"),

    //下
    BOTTOM(1,"下"),

    //左
    LEFT(2,"左"),

    //右
    RIGHT(3,"右"),

    //左上
    LEFT_TOP(4,"左上"),

    //左下
    LEFT_BOTTOM(5,"左下"),

    //右上
    RIGHT_TOP(6,"右上"),

    //右下
    RIGHT_BOTTOM(7,"右下"),

    //放大
    ZOOM_IN(8,"放大"),

    //缩小
    ZOOM_OUT(9,"缩小"),

    //近焦距
    CLOSE_FOCUS(10,"近焦距"),

    //远焦距
    FAR_FOCUS(11,"远焦距");

    /**
     * 值
     */
    private int value;

    /*
     * 描述信息
     */
    private String desc;

    /**
     * 构造函数
     */
    PTZDirectionEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 通过值转为枚举类型
     */
    public static PTZDirectionEnum fromValue(int value) {
        switch (value) {
            case 0:
                return TOP;
            case 1:
                return BOTTOM;
            case 2:
                return LEFT;
            case 3:
                return RIGHT;
            case 4:
                return LEFT_TOP;
            case 5:
                return LEFT_BOTTOM;
            case 6:
                return RIGHT_TOP;
            case 7:
                return RIGHT_BOTTOM;
            case 8:
                return ZOOM_IN;
            case 9:
                return ZOOM_OUT;
            case 10:
                return CLOSE_FOCUS;
            case 11:
                return FAR_FOCUS;
            default:
                throw new IllegalArgumentException();
        }
    }

    /**
     * 获取值
     */
    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return  this.desc;
    }

}


